﻿using Comm100.Framework.Domain.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Bot.Domain.Entities;
using Bot.Domain.Interfaces;
using Bot.Domain.Bo;
using Castle.Windsor;
using Bot.Domain.Specifications;

namespace Bot.Domain.Categories.Service
{
    public class AgentAssistSelectedChatBotDomainService : ISelectedChatBotDomainService
    {
        private IWindsorContainer _container;
        private readonly IRepository<Guid, SelectedChatBot> _repository;

        public AgentAssistSelectedChatBotDomainService(IRepository<Guid, SelectedChatBot> repository, IWindsorContainer container)
        {
            this._repository = repository;
            this._container = container;
        }

        public SelectedChatBot Create(SelectedChatBot category)
        {
            return _repository.Create(category);
        }

        public SelectedChatBot Get(Guid id)
        {
            return _repository.Get(id);
        }

        public SelectedChatBot Update(SelectedChatBotUpdateBo bo)
        {
            SelectedChatBot selectedChatBot = _repository.Get(bo.Id);
            //selectedChatBot.Id = bo.Id;
            //selectedChatBot.AgentAssistId = bo.AgentAssistId;
            selectedChatBot.ChatBotId = bo.ChatBotId;

            return selectedChatBot;

        }

        public IEnumerable<SelectedChatBot> List()
        {
            return _repository.ListAll();
        }
        public IEnumerable<SelectedChatBot> GetByAgentAssistId(Guid agentAssistId)
        {
            return _repository.List(new AgentAssistSelectedChatBotFilterSpecification(agentAssistId));
        }
        public void Delete(Guid id)
        {
            if (_repository.Exists(id))
            {
                SelectedChatBot selectedChatBot = _repository.Get(id);

                _repository.Delete(selectedChatBot);
            }
        }
    }
}
